// 接口
// 约束对象的结构

export {}

interface Post {
    title: string
    content: string
    subtitle?: string,
    readonly summary: string
}

function printPost(post: Post) {
    console.log(post.title)
    console.log(post.content)
}

printPost({
    title: 'title',
    content: 'content',
    summary: 'summary'
})


// ---------------------

interface Cache {
    [key: string]: string
}

const cache: Cache = {}
cache.foo = 'value1'
cache.bar = 'value2'